/**
 * @type {Number}
 *
 * @properties={typeid:35,uuid:"6C79078D-CF73-43AD-9C86-7FE209A2B27E",variableType:4}
 */
var fplan_id = null;

/**
 * Perform the element default action.
 *
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"DE333975-0476-4145-8414-DEE05CF9E1E5"}
 * @AllowToRunInFind
 */
function buscar(event) 
{
if ((globals.gFechaDesde != null) && (globals.gFechaHasta != null ))
{
	if (controller.find())
		{
			if (fplan_id != null)
			{
				plan_id=fplan_id
			}
			var Searchdate = new Date()
			Searchdate = utils.dateFormat(globals.gFechaDesde,'dd-MM-yyyy')+'...'+utils.dateFormat(globals.gFechaHasta,'dd-MM-yyyy')
			rec_detalle_varios_to_rec_cabecera.fecha = '#'+Searchdate +'|dd-MM-yyyy'
			rec_detalle_varios_to_rec_cabecera.codigo_movimiento=2
			var f = controller.search()
			if (f == 0)
				globals.DIALOGS.showWarningDialog('Aviso','No se encontraron resultados','OK')
		}
		else
			globals.DIALOGS.showWarningDialog('Aviso','No se puede buscar','OK')
	}
else
	globals.DIALOGS.showWarningDialog('Aviso','Por favor ingrese todas las condiciones','OK')
}

/**
 *
 * @properties={typeid:24,uuid:"752799A7-BC50-47F0-B65D-DEB626431A4D"}
 */
function limpiar() 
{
	fplan_id=null;
}

/**
 * Callback method for when form is shown.
 *
 * @param {Boolean} firstShow form is shown first time after load
 * @param {JSEvent} event the event that triggered the action
 *
 * @properties={typeid:24,uuid:"837B3B82-AE91-4C20-9753-05CBE2ED595A"}
 * @AllowToRunInFind
 */
function iniciar(firstShow, event) 
{
	fplan_id=null;
	databaseManager.revertEditedRecords()
	databaseManager.setAutoSave(true) 
	controller.find()
	plan_id=0
	controller.search()
}
